package com.itany.corejava.day09;

import java.util.Arrays;
import java.util.Comparator;

public class Test2 {

    public static void main(String[] args) {

        Student s1=new Student(5,"aaa",59);
        Student s2=new Student(1,"bbb",98);
        Student s3=new Student(3,"ccc",25);
        Student s4=new Student(2,"ddd",76);
        Student s5=new Student(4,"eee",63);


        Student[] ss={s1,s2,s3,s4,s5};

        Arrays.sort(ss);

        System.out.println(Arrays.toString(ss));

        // Arrays.sort(ss, new Comparator<Student>() {
        //     @Override
        //     public int compare(Student o1, Student o2) {
        //         return o2.getScore()-o1.getScore();
        //     }
        // });

        Arrays.sort(ss, (o1,o2)->o2.getScore()-o1.getScore());

        System.out.println(Arrays.toString(ss));

    }


}
